package com.example.dict.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;
import android.util.Log;

import com.example.dict.bean.ChengyuBean;
import com.example.dict.bean.WordBean;
import com.example.dict.bean.pinbuWordBean;
import com.example.dict.utils.CommonUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 数据库管理类
 */
public class DBManager {

    public static SQLiteDatabase db;
    //初始化数据库
    public static void initDB(Context context) {
        DBOpenHelper helper = new DBOpenHelper(context);
        db = helper.getReadableDatabase();
    }
    /**
     * 执行插入数据到PyWord表当中
     * 插入一个对象的方法
     */

    public static void insertWordToPyWord(pinbuWordBean.ResultBean.ListBean bean) {
        ContentValues values = new ContentValues();
        values.put("id",bean.getId());
        values.put("zi",bean.getZi());
        values.put("py",bean.getPy());
        values.put("wubi",bean.getWubi());
        values.put("pinyin",bean.getPinyin());
        values.put("bushou",bean.getBushou());
        values.put("bihua",bean.getBihua());
        db.replace(CommonUtil.TABLE_PYWORD,null,values);


    }

    /**
     * 插入很多数据到PyWord表当中
     * 插入了多个对象的方法
     */

    public static void insertListToPyWord(List<pinbuWordBean.ResultBean.ListBean>list) {

      if (list.size()>0){
          for (int i = 0;i<list.size();i++){
              //获取集合当中的每个遍历对象
              pinbuWordBean.ResultBean.ListBean bean = list.get(i);
              //调用每个对象插入的方法
              try {
                  insertWordToPyWord(bean);
              }catch (Exception e){
                  e.printStackTrace();
                  Log.i("错误：","insertListTopyword"+bean.getZi()+"已存在");
              }
          }
      }

    }

    /**
     * 查询PyWord当中指定拼音的数据
     */
    public static List<pinbuWordBean.ResultBean.ListBean>queryPyWordFromPyWord(String py,int page, int pagesize){
        List<pinbuWordBean.ResultBean.ListBean> list = new ArrayList<>();

        String sql = "select *from PYWORD where py=? or py like ? or py like ? or py like ? limit ?,?";
        int  start = (page -1)*pagesize;
        int end = page*pagesize;
        String type1 = py+",%";
        String type2 = "%,"+py+",%";
        String type3 = "%,"+py;
        Cursor cursor = db.rawQuery(sql, new String[]{py,type1,type2,type3, start + "", end + ""});
        while (cursor.moveToNext()){
            String id = cursor.getString(cursor.getColumnIndex("id"));
            String zi = cursor.getString(cursor.getColumnIndex("zi"));
            String py1 = cursor.getString(cursor.getColumnIndex("py"));
            String wubi = cursor.getString(cursor.getColumnIndex("wubi"));
            String pinyin = cursor.getString(cursor.getColumnIndex("pinyin"));
            String bushou = cursor.getString(cursor.getColumnIndex("bushou"));
            String bihua = cursor.getString(cursor.getColumnIndex("bihua"));
            pinbuWordBean.ResultBean.ListBean bean = new pinbuWordBean.ResultBean.ListBean(id, zi, py1, wubi, pinyin, bushou, bihua);
            list.add(bean);

        }
        return list;
    }

    /**
     * 查询PyWord当中指定拼音的数据
     */
    public static List<pinbuWordBean.ResultBean.ListBean>queryBsWordFromPyWord(String bs,int page, int pagesize){
        List<pinbuWordBean.ResultBean.ListBean> list = new ArrayList<>();

        String sql = "select *from PYWORD where bushou=? limit ?,?";
        int  start = (page -1)*pagesize;
        int end = page*pagesize;
        Cursor cursor = db.rawQuery(sql, new String[]{bs, start + "", end + ""});
        while (cursor.moveToNext()){
            String id = cursor.getString(cursor.getColumnIndex("id"));
            String zi = cursor.getString(cursor.getColumnIndex("zi"));
            String py1 = cursor.getString(cursor.getColumnIndex("py"));
            String wubi = cursor.getString(cursor.getColumnIndex("wubi"));
            String pinyin = cursor.getString(cursor.getColumnIndex("pinyin"));
            String bushou = cursor.getString(cursor.getColumnIndex("bushou"));
            String bihua = cursor.getString(cursor.getColumnIndex("bihua"));
            pinbuWordBean.ResultBean.ListBean bean = new pinbuWordBean.ResultBean.ListBean(id, zi, py1, wubi, pinyin, bushou, bihua);
            list.add(bean);

        }
        return list;
    }
    /**
     * 插入汉字到文字详情表里
     */

    /**
     * id : 76607d1b02faa953
     * zi : 天
     * py : tian
     * wubi : gdi
     * pinyin : tiān
     * bushou : 大
     * bihua : 4
     * jijie : ["天","tiān","在地面以上的高空：天空。天际。天罡（北斗星）。天渊（上天和深渊，喻差别大）。天马行空（喻气势豪放，不受拘束）。","在上面：天头（书页上面的空白）。","气候：天气。天冷。","季节，时节：冬天。","日，一昼夜，或专指昼间：今天。","指神仙或他们所住的地方：天上。天宫。","自然界：天堑。天时。天籁（自然界的声音，如风声、鸟声、流水声）。","〔天干（","自然的、生成的：天然。天性。天职（应尽的职责）。天才（ａ．卓绝的创造力、想象力，突出的聪明智慧；ｂ．有这种才能的人）。天伦之乐。g乶 ）〕古代用来记日或年的字，有\u201c天干\u201d和\u201c地支\u201d两类，天干共十字：甲乙丙丁戊己庚辛壬癸，亦称\u201c十干\u201d。","dayGodHeavennatureskyweather地","","笔画数：4；","部首：大；","笔顺编号：1134"]
     * xiangjie : ["天","tiān","【名】","(会意。甲骨文字形。下面是个正面的人形(大),上面指出是人头,小篆变成一横。本义:人的头顶)","同本义〖top〗","天,颠也。\u2026颠者,人之顶也。以为凡高之称。\u2014\u2014《说文解字注》","又如:天灵(人或其他动物的头顶骨);天灵盖(头顶骨)","古代的墨刑。在额头上刺字的刑罚〖tattoinfront〗","天,刑名。剠凿其额曰天。\u2014\u2014《集韵》","《其人天且劓。\u2014\u2014《易·睽卦》。虞注:\u201c黥额为天。\u201d","天空〖sky〗","天,至高无上。\u2014\u2014《说文》","天,气也。\u2014\u2014《论衡·谈天》","形天与帝至此争神,帝断其首。\u2014\u2014《神话四则·形天》","天似穹庐。\u2014\u2014《乐府诗集·杂歌谣辞·敕勒歌》","天苍苍。","接天莲叶无穷碧。\u2014\u2014宋·杨万里《晓出净慈寺送林子方》","仰视天。\u2014\u2014清·薛福成《观巴黎油画记》","又如:天澄澄(天色澄清的样子);天色(天空色);天宇(天空);天日(天空与太阳);天角(天之一隅);天盘(天际);天弩(天空;天空高远)","天帝,上天。古人以天为万物主宰者〖Heaven〗","休祲降于天。\u2014\u2014《战国策·魏策》","有夏多罪,天命殛之。\u2014\u2014《书·商书》","天下所启。\u2014\u2014《左传·僖公二十三年》","天赐也。","天其或者将逮诸。","天将兴之,谁能废之。","此天之亡我,非战之罪也。\u2014\u2014《史记·项羽本纪》","天将降大任。\u2014\u2014《孟子·告子下》","天以卿二人赞孤也。\u2014\u2014《资治通鉴》","又如:天可怜见(上天救助,老天保佑);天庖(天帝的庖厨);天马(神马;骏马的美称);天丁(天兵);天功(天的职任;天然形成的工巧);天打雷劈;天休(天赐福佑);天佑(上天佑助)","天堂〖palace〗。","如:天居(住在天上);天陛(天宫台阶)","一昼夜〖day;periodoftimtinaday〗。","如:天把(一两天,一天半天);夏天天长夜短;今天;明天","比人类品质更高尚和能力更强大的存在〖god〗","违天不祥。\u2014\u2014《左传·僖公三十二年》","此乃天也。\u2014\u2014《资治通鉴》","又如:天晓得;我的天","自然所生成的事物〖nature〗","与天不老。\u2014\u2014清·梁启超《饮冰室合集·文集》","又如:巧夺天工;天性如此;天衣无缝;文章天成;天演(自然进化);天巧(自然工巧);天式(自然法式);天光(自然的智慧之光);天财(自然财富)","一年里的特定时候〖season〗。","如:天中节(端午节);夏天;黄梅天","气象状态〖weather〗","秋天漠漠向昏黑。\u2014\u2014唐·杜甫《茅屋为秋风所破歌》","天阴雨湿声啾啾。\u2014\u2014唐·杜甫《兵车行》","心忧炭贱愿天寒。\u2014\u2014唐·白居易《卖炭翁》","天阴黑。\u2014\u2014《资治通鉴·唐纪》。","又如:天风馋(冷风袭人,易使人生病);天变了","丈夫〖husband〗。","如:失其所天","指先天不足〖defectsofmale〗","此天之所不足也。\u2014\u2014《灵枢》","古代指君王〖emperor〗。","如:天颜(皇帝之面);天表(天子的仪表);天恩;天邑(帝王之都);天位(天子之位)","头等大事〖majorevent;matterofparamountimportance〗","王者以民人为天,而民人以食为天。\u2014\u2014《史记·郦生陆贾列传》","人的额部〖front〗。","如:天炙(朱水点额)","姓","","天","tiān","【形】","天然的;天生的〖natural〗","依乎天理,批大卻,导大窾。\u2014\u2014《庄子·庖丁解牛》","又如:天性;天资","顶上的;架空的〖builtonstilts;suspendinginmidair〗。","如:天桥;天窗;天棚","","天安门","Tiān\u2019ānmén","〖TianAnMen(GateofHeavenlyPeace)〗北京市重要古建筑。位于北京市区中央,其前的广场是世界最宽广、壮观的广场","天半","tiānbàn","〖sky〗高空,如在半天之上","俱秀出天半。\u2014\u2014《徐霞客游记·游黄山记》","天宝","tiānbǎo","〖thetitleoftheEmperorTangXuanzong'sreign〗唐玄宗李隆基的年号(公元742\u2014\u2014755年)","开元天宝之际。\u2014\u2014宋·苏轼《教战守》","天崩地坼","tiānbēng-dìchè","〖naturaldisasterslikegiantearthquakesandlandslides〗天倾塌,地开裂。比喻异常灾祸、不测变故。形容震天动地的巨响","只听得海外一个大炮如天崩地坼的一连响了百余响。\u2014\u2014《水浒后传》","亦作\u201c天崩地裂\u201d、\u201c天崩地坍\u201d、\u201c天崩地塌\u201d、\u201c天崩地陷\u201d、\u201c天崩地解\u201d","天边","tiānbiān","〖theremotestplacesastheendsoftheearth;beyondthehorizon〗无限的空间","你从哪里来的,亲爱的小东西?从天边来到这里","天兵","tiānbīng","〖invinciblearmyastroopsfromheaven〗∶神话中指天神的兵。比喻英勇善战所向无敌的军队","〖imperialtroops〗∶指帝王的军队","天禀","tiānbǐng","〖nativeendowments〗天资;天赋","文词虽少作,勉强非天禀。\u2014\u2014苏轼《监试呈诸试官》","天禀聪颖","天不绝人","tiānbùjuérén","〖Heavenwouldnotfailaman;findone'swayoutfromanimpasse〗人生的道路千条万条,只要努力进取,总不致陷入绝路。多指绝望境地摆脱之后的感慨","天不怕，地不怕","tiānbupà,dìbupà","〖fearneitherHeavennorEarth;fearnothingatall〗只要走得端、行得正,天地间的事全然不惧怕。形容大无畏的精神","原来姑娘天不怕,地不怕,就怕膈肢他的膈肢漥。\u2014\u2014《儿女英雄传》","天不转地转","tiānbùzhuàndìzhuàn","〖wellmeetsomeday〗意指以后总有见面的机会","天才","tiāncái","〖genius;talent;endowment;gift〗天赋的才能;卓绝的创造力、想象力;天然的资质","他有艺术天才","少有的幸运的天才如居里夫妇、达尔文、牛顿","天差地远","tiānchā-dìyuǎn","〖polesapart〗天上与地下,相距遥远。形容差得太多、太远、太大","她俩的隔阂与生俱来,天差地远,很难谈得拢","天长地久","tiāncháng-dìjiǔ","〖beenduringastheuniverse;aslongastheworldlast〗天地的存在最为长久。用以比喻情感、友谊等与天地共存","天长地久有时尽,此恨绵绵无绝期。\u2014\u2014白居易《长恨歌》","天长日久","tiāncháng-rìjiǔ","〖afteraconsiderableperiodoftime〗天之长,日之久。比喻长期下去,时间久远","天长日久,这等几间小屋子,弄一对大猱头狮子,不时的对吼起来,更不成事!\u2014\u2014《儿女英雄传》","天朝","tiāncháo","〖Celestial;imperialcourt〗∶封建时代臣下称本朝的朝廷;藩属尊称宗主","〖theTaipingHeavenlyKingdom〗∶太平天国自称","天赐之福","tiāncìzhīfú","〖mercy〗被认为是一种天赐的恩惠或怜悯的仁慈","好像全部忘记了他日常生活中的许多天赐之福","天赐良机","tiāncì-liángjī","〖Heaven-sentchance〗天给的好机会","可能使因天赐良机而可以写得充实出色的巨大的题材变得索然无味","天从人愿","tiāncóngrényuàn","〖Heavencarriesoutthedesiresofman〗如愿以偿,好似天助其成。形容客观自然条件与主观上要做的事恰好相一致","\u201c你没带伞怎么没淋着?\u201d\u201c天从人愿,我一下车雨正好停了。\u201d","天大","tiāndà","〖extremelybig;aslargeastheHeavens〗非常大;极言其大","天大的事我顶着","天道","tiāndào","〖spritualprinciples;divineorderofthings〗自然规律","天道变化。\u2014\u2014〖英〗赫胥黎著、严复译《天演论》","天敌","tiāndí","〖naturalenemy〗自然界中某种动物专门捕食或危害另一种动物","猫是鼠的天敌,寄生蜂是某些作物害虫的天敌","天底","tiāndǐ","〖nadir〗从观测者垂直向下与天球的交点或与天顶相距180°的点","天底下","tiāndǐxia","〖inthisworld;underthesun〗指世界上","天底下竟有这样的事","天地","tiāndì","〖heavenandearth;universe;world〗∶天和地。指自然界和社会","天地山川。\u2014\u2014宋·王安石《游褒禅山记》","天地之闻。\u2014\u2014清·黄宗羲《原君》","天地之大","震动天地。\u2014\u2014明·张溥《五人墓碑记》","〖scopeofoperation;fieldofactivity〗∶比喻人们活动的范围","〖nature;betweenHeavenandearth〗指天地之间,自然界","天地之精也。\u2014\u2014《吕氏春秋·慎行论》","天地百法乎。\u2014\u2014清·洪亮吉《治平篇》又","天地调剂之法也。","天地不能生人。","天地之所以养人也。","天地良心","tiāndì-liángxīn","〖fromthebottomofmyheart〗表白自己的用语。意为:天知地知,自己也问得过良心,确实没有说假话、做坏事","天帝","Tiāndì","〖CelestialRulerSupremeGod〗神话传说中天上的主神","天电","tiāndiàn","〖static;atmospherics〗大气的电现象","天顶","tiāndǐng","〖zenith〗在地球表面任一观测点的铅垂线向上延长,与天球相交的一点","天罚","tiānfá","〖punishmentmetedoutbyGod;standcondemnedbyGod〗∶上天的诛罚。旧时帝王自谓禀承天意行事,其诛罚不臣常以此为名","〖loseone'sparents〗∶旧称遇父母丧","天翻地覆","tiānfān-dìfù","〖stateofextremeconfusionastheskyandtheearthturningupsidedown;earth-shaking〗∶形容彻底的变革","虎踞龙盘今胜昔,天翻地覆慨而慷。\u2014\u2014毛泽东《人民解放军占领南京》","〖intotaldisorder;extremeupheaval;insheerpandemonium〗∶形容秩序极为混乱","宝玉一发拿刀弄杖寻死觅活的,闹的天翻地覆。\u2014\u2014《红楼梦》","天方","Tiānfāng","〖Arabia〗我国古时指阿拉伯","《天方夜谭》","天方夜谭","TiānfāngYètán","〖TheArabianNights〗∶书名,又名《一千零一夜》,是一部阿拉伯民间故事集,其中有不少荒诞不经的地方","〖anincrediblestory;afantastictalk;boastfulwords〗∶比喻虚诞夸饰的议论;荒诞不经的说法","郑子云的话在他看来是书呆子的呓语,咬文嚼字、天方夜谈、理想主义。\u2014\u2014张洁《沉重的翅膀》","天分","tiānfèn","〖genius;gift;talent〗天资;天赋","天府","tiānfǔ","〖landofabundance〗天然的府库,比喻物产富饶","天府之土。\u2014\u2014《三国志·诸葛亮传》","天府之国","tiānfǔzhīguó","〖landflowingwithmilkandhoney;landofplenty〗指肥美险固、物产饶多之地","天父","tiānfù","〖HeavenlyFather;ourheavenlyFather〗∶视为始祖的男性代表或阳性本源的天国的神","〖theemperor〗∶天子","〖father〗∶对父亲的尊称","〖God〗∶太平天国以天父称上帝","天赋","tiānfù","〖innate;inborn;beendowmentbynature〗∶天资;资质","数学方面的才能\u2026主要来自天赋","〖native;gifted〗∶生来具有的;禀受于天的","天赋的艺术才能","有着天赋的优美嗓子","为了适应学术上的需要,一定的天赋智能是必要的","天干","tiāngān","〖thetenHeavenlystemstodesignatemarksoforder〗用于表现次序的符号,常和\u201c地支\u201d连用,包括甲、乙、丙、丁、戊、己、庚、辛、壬、癸","天高地厚","tiāngāo-dìhòu","〖profound;deep〗∶感恩戴德之词","天高地厚,未酬万一。\u2014\u2014《醒世通言》","〖complexityofallthingasimmensityoftheuniverse〗∶犹言高低轻重","想起幼年这些不知天高地厚的话来,真愧悔。\u2014\u2014《儿女英雄传》","天高皇帝远","tiāngāohuángdìyuǎn","〖theemperorisfarawayasthesky〗∶旧指王法所难以顾及的边远地域","〖onemaydowhateverhepleaseswithoutfearoftheinterference〗∶比喻不听管束、无法无天","天高气爽","tiāngāo-qìshuǎng","〖theskyishighandtheweatherfine〗形容秋天天空高远明朗、气候凉爽宜人","天各一方","tiāngèyīfāng","〖livefarapartfromeachother〗通常指家庭或朋友分住在各处","天工","tiāngōng","〖workofnature;formedbynature〗天然形成的高超技艺","天公","tiāngōng","〖theHeaven〗∶天。以天拟人,故称","〖therulerofheaven;God〗∶神话传说中指自然界的主宰者","天公不作美","天公地道","tiāngōng-dìdào","〖beabsolutelyfairreasonable〗意即十分公平合理","天宫","tiāngōng","〖heavenlypalace〗上帝或诸神在天上的住所;天国","天沟","tiāngōu","〖gutter〗用于屋顶的排水沟,多用白铁皮或石棉水泥制成","天钩","tiāngōu","〖skyhook〗荒谬的事物,想象为从天上挂下来的钩子","天光","tiānguāng","〖daylight;skylight〗∶日光;天空的光辉","我们且离了这个地方,外面见见天光,可好不好?\u2014\u2014《儿女英雄传》","水色天光","〖daytime〗∶白昼","来回九十里,现在天光又短,一霎就黑天,\u2026。\u2014\u2014《老残游记续集遗稿》","〖timeoftheday〗∶天色","〖morning;daybreak〗[方言]∶早晨;天亮","〖timeofthedayandlandscapeoflakes〗天色与湖光","上下天光。\u2014\u2014宋·范仲淹《岳阳楼记》","天国","tiānguó","〖Clestialcity;KingdomofHeaven〗∶基督教称一切服从上帝的无形的人类社会","〖paradise〗∶天堂;比喻理想世界","〖theTaipingHeavenlyKingdom〗∶太平天国的省称","天寒地冻","tiānhán-dìdòng","〖weatheriscoldandgroundisfrozen〗天上寒冷,大地封冻。形容气候严寒","天寒地冻不怕冷,荒原一片篝火红","天汉","Tiānhàn","〖theMilkyWay〗","书面语称银河","汉武帝刘彻的年号(公元前100\u2014\u2014前97)","天汉元年。\u2014\u2014《汉书·李广苏建传》","天河","Tiānhé","〖theMilkyWay;Galaxy〗银河","天黑","tiānhēi","〖it'sdark〗∶太阳落下后,天色变黑","〖cloudy〗∶光线不足,不明亮","天候","tiānhòu","〖weather〗在一定的时间内,某一地方的大气物理状态,如气温、气压、温度、风、降雨等","天花","tiānhuā","〖smallpox〗∶由天花病毒引起的一种烈性传染病,表现为严重的病毒血症及接连出现的各阶段皮疹,皮疹最后以脓泡、脱痂及瘢痕形成为特征","〖tassel〗∶玉蜀黍的雄花,因为长在植株的顶部,所以叫天花","〖snow〗∶雪花","夜散下无数茸毛似的天花,织成一片大氅。\u2014\u2014闻一多《雪》","天花板","tiānhuābǎn","〖ceiling〗","设想为如悬空的遮蔽物或极高的棚帐的某些事物","房间内部顶上的衬料;上层楼板的底面","〖plafond〗∶通常做成精细图案的顶棚","天花乱坠","tiānhuā-luànzhuì","〖makeaverywildboastaboutsth.asifitwererainingflowers〗亦作\u201c天华乱坠\u201d。佛教传说:佛祖讲经,感动天神,各色香花,纷纷下坠。后以此语形容言谈虚妄、动听而不实在","他总把这个村的工作说得天花乱坠","天荒地老","tiānhuāng-dìlǎo","〖indaysofold〗形容经历的时间漫长。也说\u201c地老天荒\u201d","天皇","tiānhuáng","〖God;theHeavenlyRuler;theSupreme〗∶天帝","〖TianHuang〗∶古帝名,传说中国远古三皇(天皇、地皇、泰皇)之首","〖emperor〗∶帝王","〖emperorofJapan;Mikado〗∶日本的皇帝,他是宗教的领袖,并且被认为是神的化身","天昏地暗","tiānhūn-dì\u2019àn","〖thereisgloomaboveandderknessbelow〗原指自然景象,现在常用来比喻思想上的糊里糊涂","我爸那脾气你知道,骂得我天昏地暗,我真没辙了","天昏地暗,天昏地黑","tiānhūn-dì\u2019àn,tiānhūn-dìhēi","〖amurkyskyoveradarkearth;darkaround〗∶天地一片昏黑。常用以形容风霾、雷雨时的自然景象","只见天昏地黑,日月无光","〖It'sgettingdark〗∶指天色晚","妖魔支着长枪道:\u201c悟空,你住了。天昏地暗,不是个赌斗之时。\u201d\u2014\u2014《西游记》","〖terribly;fiercely;very〗∶非常利害","这场恶战,直杀得天昏地暗,山岳动摇。\u2014\u2014《荡寇志》","〖rottenanddark〗∶比喻社会黑暗腐败","一条街代表租界,一条街代表中国城,前者是清洁,美丽,有秩序;后者是污浊,混乱,天昏地暗。\u2014\u2014老舍《二马》","天鸡","tiānjī","〖Chickenoversky〗神话中天上的鸡","空中闻天鸡。\u2014\u2014唐·李白《梦游天姥吟留别》","天机","tiānjī","〖thesecretlikeGod'sdesign〗∶上天的机密","〖secret〗∶泛指秘密","一语道破天机","〖sth.inexplicablelikenature'smystery〗∶天赋的灵机,即灵性","天极","tiānjí","〖celestialpole〗∶天球上的两点之一,在这两点周围的恒星都呈现周日运动。对于地球,地轴延长和天球相交的两点叫做天极。在北半球的叫北天极,在南半球的叫南天极","〖horizon;theendsoftheearth〗∶天边;天际","天际","tiānjì","〖horizon〗肉眼能看到的天地交接的地方","孤帆远影碧空尽,唯见长江天际流","天假良缘","tiānjiǎ-liángyuán","〖anaffinitygivenbyHeaven〗∶天然遇合的美满姻缘","〖ararechance〗∶天然促成的良好机遇或缘分","天骄","tiānjiāo","〖Northerntribeoritsruler〗汉代人称北方匈奴单于为天之骄子,后来称某些北方强盛的民族或其君主","一代天骄,成吉思汗","天经地义","tiānjīng-dìyì","〖unalterableprinciple;naturelawandearth'sway〗∶天地间本当如此、不可更改的道理","〖amatterofcourse〗∶指理所当然,无可非议的事情","天井","tiānjǐng","〖raise〗∶矿井中为连接某一工作地区和高一层另一工作地区而开凿的垂直或倾斜井或通道","〖courtyard〗∶宅院中房子和房子或房子和围墙所围成的露天空地;院落","〖skylight〗∶某些地区的旧式房屋为了采光而在房顶上开的洞","天镜","tiānjìng","〖abrightmoon〗∶喻指明月","〖clearwatersurface〗∶喻指澄静的水面","开帆入天镜。\u2014\u2014宋·陆游《过小孤山大孤山》","天开","tiānkāi","〖flight〗超越常规的活动,〖思想精神等〗焕发、奔放","异想天开","天空","tiānkōng","〖sky〗地球周围的广大空间","天籁","tiānlài","〖soundsofnature〗自然界的声音,物自然而然发出的声音。如风声、鸟声、流水声等","天蓝色","tiānlánsè","〖cerulean;azure;skyblue〗类似晴空的颜色","天朗气清","tiānlǎng-qìqīng","〖fine〗天、色明朗,大气清和","是日也,天朗气清,惠风和畅。\u2014\u2014晋·王羲之《兰亭集序》","天老儿","tiānlǎor","〖albino〗指体内色素缺乏,全身毛发呈白色或淡黄色,皮肤呈白色或淡红色,眼睛怕见较强的光的人,是一种先天性发育异常的人","天老爷","tiānlǎoye","〖Heavens〗老天爷","天理","tiānlǐ","〖natural'slaw〗∶自然法则;天道,天然的组织结构","依乎天理。\u2014\u2014《庄子·养生主》","〖heavenlyprinciples;moralprinciples〗∶宋代的理学家认为封建伦理是客观存在的道德法则,把它叫做\u201c天理\u201d","〖moralprinciples;morality〗∶道义","〖nature;naturalinstincts〗∶天性","天理教","Tiānlǐjiào","〖theEightDiagramsReligionofthe18thcenturyinChina〗十八世纪中叶白莲教武装起义失败后,由部分教徒组织起白莲教的一个支派,称\u201c天理教\u201d,曾在北京、河南发动起义。又称\u201c八卦教\u201d","天理良心","tiānlǐ-liángxīn","〖thecourseofnatureandone'sconscience〗感叹用语,近似\u201c天地良心\u201d。含义是:总要讲点天理,讲点良心。亦用于发誓,表示凭天性和善心行事","一到院里,只听凤姐说道:\u201c天理良心!我在这屋里熬的越发成了贼了!\u201d\u2014\u2014《红楼梦》","天理难容","tiānlǐ-nánróng","〖intolerablejustice〗指天地与公理难以宽容","那时我等占了他的城池,大王称帝,我等称臣,\u2014\u2014虽然也有个大小官爵,只是天理难容也。\u2014\u2014《西游记》","亦作\u201c天理不容\u201d","天理昭彰","tiānlǐ-zhāozhāng","〖God'slawjusticeismanifest〗天道与公理昭然明著,善恶无所掩藏","天理昭彰,他要害我们闹出一场故事,不想他自己倒闹出一场笑话了。\u2014\u2014《花月痕》","天良","tiānliáng","〖consciene〗人的良心","丧尽天良","天亮","tiānliàng","〖daybreak;dawn〗太阳快要露出地平线时天空发出光亮","天灵盖","tiānlínggài","〖topoftheskull;crownofthehead〗指人或某些动物头顶的骨头","天伦","tiānlún","〖naturalbondsandethicalrelationshipbetweenfamilymembers〗∶指父子、兄弟等亲属关系","天伦之乐","〖lawofnature;naturallaw;thewillofHeaven〗∶自然的道理","合于天伦","天伦之乐","tiānlúnzhīlè","〖familyhappiness〗父母子女,团聚一堂,融融洽洽的乐趣","共叙天伦之乐","天罗地网","tiānluó-dìwǎng","〖netsaboveandsnaresbelow;dragnetthatthecriminalshavenowaytoescape〗天上、地下到处是罗网。形容上下四方尽被包围,无路可逃","天麻","tiānmá","〖tuberofelevatedgastrodia〗∶一种多年生腐生草本植物(Gastiodiaelata),全株无叶绿素,地下有肉质肥厚的块茎,地上茎直立。块茎入药","〖gastrodiatuber〗∶用作中药的此种植物的干块茎。别名赤箭、明天麻、定风草。熄风,定惊。治虚风眩晕、头晕、头痛,惊风抽搐、癫痫、肢体麻木、半身不遂","天马行空","tiānmǎ-xíngkōng","〖bepowerfulandunstrainedlikeaheavenlysteedsoaringacrosstheskies〗天神之马来往疾行于空中。比喻思想行为无拘无束。亦形容文笔超逸流畅","天马行空,独往独来","天门","tiānmén","〖gateofheavenlypalace〗∶神话传说中天宫的门","〖gateofpalace〗∶帝王宫殿大门","〖middleofforehead〗∶指人额头的中间","〖heart〗∶人的心(道士用语)","天门冬","tiānméndōng","〖lucidasparagus〗∶一种多年生草本攀援植物(Asparaguscochinchinensis),地下有簇生纺锤形块根,叶退化,由绿色线形叶状枝代替叶的功能。块根入药","〖asparagusroot〗∶此种植物的干块根。别名天冬。对各型葡萄球菌、链球菌、肺炎球菌、白喉杜菌有抑制作用。天门冬素有镇咳、祛痰作用","天明","tiānmíng","〖daybreak;dawn〗天亮","天明登前途。\u2014\u2014唐·杜甫《石壕吏》","天命","tiānmìng","〖God'swill;destiny;fate〗∶指上天的意志;也指上天主宰之下的人们的命运","乐夫天命复奚疑。\u2014\u2014晋·陶渊明《归去来兮辞》","虽曰天命。\u2014\u2014宋·欧阳修《新五代史·伶官传》","〖lawofnature;naturallaw〗∶自然的规律、法则","〖naturalspanoflife;one'sallottedspan〗∶人的自然寿命;天年","天幕","tiānmù","〖canopyoftheheavens〗∶笼罩大地的天空","〖backdropofstage〗∶舞台后面悬挂的大布幔,演出时配合灯光以表现天空景象","〖tent〗∶帐篷","游猎民族的天幕、小舍,完全为避风雨起见,还没有美术的形式。\u2014\u2014蔡元培《美术的起源》","天南地北,天南海北","tiānnán-dìběi,tiānnán-hǎiběi","〖separatefarandwide;befarapart〗∶相距遥远","〖everyandanysubjectunderthesun〗∶形容〖谈话〗漫无边际","〖fromdifferentplacesorareas〗∶形容地区各不相同","天年","tiānnián","〖one'sallottedspan;naturalspanoflife〗∶自然的寿数","尽其天年。\u2014\u2014明·张溥《五人墓碑记》","〖theyear\u2019sharvest〗[方言]∶年成","今年天年不好,粮食收成少","〖time〗[方言]∶时期;时代","这种打仗的天年,家家的日子都不好过","天牛","tiānniú","〖long-hornedbeetle;longhornbeetle〗任何种构成天牛科的甲虫,以其特别长的触角来鉴别","天怒人怨","tiānnù-rényuàn","〖wrathofGodandresentmentofmen;widespreadindighationanddiscontentamongthepeople〗极言统治者的暴虐无道,使所有的人愤怒、怨恨","天棚","tiānpéng","〖awningorcanopyofbamboo〗∶在户外用竹木席幔等搭起的棚,用以遮蔽风雨日光","〖ceiling〗∶房屋内部在屋顶或楼板下面加的一层东西,或用木板做成,或在木条、苇箔上抹灰,或在苇箔、秫秸上糊纸,有保温、隔音、美观等作用","天启","Tiānqǐ","〖thetitleoftheEmperorMingXizong'sreign〗明熹宗朱由校的年号(公元1621\u20141627年)","天启壬戌秋日。\u2014\u2014明·魏学洢《核舟记》","天平","tiānpíng","〖weighingscales;balance〗一种衡器。由支点(轴)在梁的中心支着天平梁而形成两个臂,每个臂上挂着一个盘,其中一个盘里放着已知重量的物体,另一个盘里放待称重的物体,固定在梁上的指针在不摆动且指向正中刻度时的偏转就指示出待称重物体的重量","天气","tiānqì","〖weather〗在较短时间内特定地区的大气状况;气象情况","天气形势","tiānqìxíngshì","〖weathersituation〗表示高低空环流状况和高、低气压及锋面等天气系统的分布概况。能显示未来一定时间内的天气演变趋势。是各级气象台、站作好天气预报的依据","天气预报","tiānqìyùbào","〖weatherforecast〗","有关一项或多项天气要素的未来大气状态的预报","对未来一定时期内天气变化的预报。根据天气形势、天气图的分析,结合有关气象资料、地形及季节特点、群众经验等综合研究后作出。就空间范围讲,有本地和区域等;就时效长短讲,通常分短期(一般指2\u20143天)、中期(3\u201415天)及长期(10\u201415天)三种。按农业、渔业、航空、交通运输等生产部门的特点和需要,又有各种不同的专业天气预报。天气预报是气象为国防和国民经济建设服务的重要手段","天遣","tiānqiǎn","〖God'spunishment〗强调痛苦的严酷,使人联想起天罚","天谴,打击,瘟疫","天堑","tiānqiàn","〖naturalmoat〗∶天然形成的隔断交通的大壕沟","长江天堑","〖theChangjiangRiver(YangtseRiver)〗∶长江","金陵空壮观,天堑净波澜。\u2014\u2014李白《金陵》","〖QiantangRiver〗∶钱塘江","云树绕堤沙,怒涛卷霜雪,天堑无涯。\u2014\u2014柳永《望海潮》","〖theHuangheRiver;theYellowRiver〗∶黄河","天堑波光摇落日,太行山色照中原。\u2014\u2014金·李汾《汴梁杂诗》","天桥","tiānqiáo","〖platformbridge〗∶火车站里为了旅客横过铁路而在铁路上空架设的桥","〖overpass;overbridge〗∶路口或交通繁忙路线的上跨桥","〖overlinebridge〗∶一种高而窄,形状略像独木桥,两端有梯子的体育运动设备","〖monkeybridge〗∶甲板上或机舱中,高悬的狭窄通道","〖SkyBridge〗∶地名。在我国北京市天坛附近","天穹","tiānqióng","〖vaultofheaven〗从地球表面上看,像半个球面似的覆盖着大地的天空;天空","一颗流星划过蔚蓝的天穹而陨落","天球仪","tiānqiúyí","〖celestialglobe〗代表天球的一个小球,在天球仪上给出恒星的可视视位置;中国古代的天球仪刻画着星座、赤道、黄道等的位置,叫浑天仪或浑象","天趣","tiānqù","〖beautyofnatureobjectsorphenomena〗自然的情趣","天趣盎然","天然","tiānrán","〖natural〗∶自然赋予的;生来就有的;自然生成的;自然形成的","天然气","天然港湾","天然放射性","〖ofcourse;naturally〗∶理所当然,自然而然","瑞丰觉得假若冠先生出头和东阳竞争,他天然的应当帮助冠先生。\u2014\u2014老舍《四世同堂》","天然气","tiānránqì","〖naturalgas〗产生于地表之下的低分子量键烷烃的可燃气体混合物","天壤","tiānrǎng","〖heavenandearth〗∶天和地","天壤间","〖polesapart;aworldofdifference〗∶相隔极远;相差极大","天壤之别","tiānrǎngzhībié","〖bevastlydifferentasbetweenheavenandearth〗高天和平地的区别。极言差别之大","天人","tiānrén","〖heavenandman〗∶天和人;天象和人事","天人之际","天人合一","〖celestialbeing;immortal;outstandingman(intalentorappearance)〗∶仙人;神人;才能或容貌出众的人","〖emperor〗∶特指天子","天人相应","tiānrén-xiāngyìng","〖correspondencebetweenmananduniverse〗指人体与大自然有相似的方面或相似的变化。《灵枢·邪客》∶\u201c此人与天地相应者也\u201d。其主要精神揭示在预防疾病及诊治疾病时,应注意自然环境及阴阳四时气候等诸因素对健康与疾病的关系及其影响。例如在辩证论治时,必须注意因时、因地、因人制宜等","天日","tiānrì","〖skyandsun;light〗天空和太阳,喻指光明","天色","tiānsè","〖colouroftheskyandtimeofthedayitshows〗天空的颜色,借指时间的早晚和天气的变化","看天色怕要下雨","天色不早,你该走了","天山","TiānShān","〖Tianshan〗亚洲中部大山系,东段在中国新疆中部,西段在中亚。多5000米以上山峰,主峰托木尔峰7439米","天上人间","tiānshàng-rénjiān","〖heavenandearth;heavenandtheworld〗∶天上和人间","〖aworldofdifference〗∶比喻客观条件迥异,差别极大。亦作\u201c人间天上\u201d","天生","tiānshēng","〖inborn;born;innate;inherent〗∶天然生成","在他身上有一股天生的活力,就像阿尔卑斯山山洪一样","天生的领袖","她天生温文有礼","他天生爱美","某种天生的进行观察上的无能","〖bedestined〗∶命中注定","但是功名迟早自有一定,天生应叫的苦也要吃的。\u2014\u2014《儿女英雄传》","天圣","Tiānshèng","〖thetitleoftheEmperorSongRengzong'sreign〗宋仁宗赵祯的年号(公元1023\u20141032年)","天师","Tiānshī","〖Taoistmaster〗道教创始人张道陵的传衣钵的人,被选为道教的首领","天时","tiānshí","〖theorderofnature〗∶自然运行的时序","天时有愆伏。\u2014\u2014宋·沈括《梦溪笔谈》","今天时顺正。\u2014\u2014清·方苞《狱中杂记》","〖climaticcondition〗∶指有利于攻战的自然气候条件","天时不如地利。\u2014\u2014《孟子·公孙丑下》","必有得天时。","是天时不如地利。","〖fat;God'swill;destiny〗天命","非为天时。\u2014\u2014《三国志·诸葛亮传》","〖time;timeoftheday〗∶时候","当时大家钱尽,天时又有一点多钟,只好散了。\u2014\u2014《老残游记》","我见天时尚早,便到外面去闲步。\u2014\u2014《二十年目睹之怪现象》","天使","tiānshǐ","〖angel〗指天神的使者。西方文学艺术中,天使的形像多为带翅膀的少女或小孩。现在常用来比喻天真可爱的人(多指女子或小孩)","天授","tiānshòu","〖begivenbyHeaven〗指上天所授予;天赋","天书","tiānshū","〖abstruseorillegalwritingasamysticbookfromheaven〗∶天上神仙写的书或信(迷信)","对我来说,这本书就跟天书一样难懂","〖abstrusewriting;illegiblewriting〗∶比喻难认的文字或难懂的文章","这封信字太潦草,像天书似的","〖imperialedict〗∶古代帝王的诏书","天数","tiānshù","〖predestination〗指由上天给安排的命运","天塌地陷","tiāntā-dìxiàn","〖naturaldisasterslikegiantearthquakesandlandslides〗∶天坍塌,地裂陷。比喻重大灾变","〖serious〗∶形容事情严重","天塌地陷的事,他也等明天再说","天坛","Tiāntán","〖TheTempleofHeaveninBeijing〗明清两代帝王用以祭天和祈祷丰年的建筑。在原北京外城的东南部。始建于明永乐十八年(1420年)。总面积为273公顷。主要建筑祈年殿、皇穹宇、圜丘建造在南北纵轴上","天堂","tiāntáng","〖heaven;paradise〗","某些宗教指正直者死后的灵魂居住的美好的地方","死后进天堂","美好的生活环境","〖forehead〗[方言]∶指额头","黄泥浆从他的天堂上、眼睛边、嘴边往下淌","天梯","tiāntī","〖highladder〗∶多装置在较高的建筑、设备上的很高的梯子","〖stepstoheavens;highandsteepmountainpaths〗∶古人想象中的登天的阶梯。比喻高而险的山路","天体","tiāntǐ","〖celestialbody〗∶宇宙中恒星、行星、卫星、彗星、宇宙尘、流星、星云等的统称","〖naked〗∶赤身","儿子光着屁股的周岁天体照,笑的那么可人","天天","tiāntiān","〖everyday〗∶平常或老一套","〖everyday;daily;dayin,dayout〗∶每天","他天天去上学","有的报纸天天出版","他天天如此,除了工作以外就不干别的","天条","tiāntiáo","〖lawsofheaven〗∶旧谓上天的律令、法规","〖prohibitionmadebyTaipingHeavenlyKingdom〗∶太平天国称所定禁令","天庭","tiāntíng","〖God'scourt;God'spalace〗∶天帝的宫廷;天帝的朝廷","〖imperialcourt〗∶帝王的宫廷;朝廷","〖thesky〗∶天空","这种种声音在无边无际的天庭中响着。\u2014\u2014胡也频《光明在我们的前面》","〖middleofthehead〗∶指前额的中央","天庭饱满","天头地角","tiāntóu-dìjiǎo","〖topmarginandbottommargin〗书面或册页上下两头的空白","天外有天","tiānwài-yǒutiān","〖thereareskiesbeyondourskies〗比喻知识、本领是没有止境的","天王","tiānwáng","〖emperor〗∶天子","〖HongXiu-quan(HungHsiu-chuan)〗∶太平天国的洪秀全自封天王","〖god〗∶某些威力很大的天神","天王老子","tiānwánglǎozi","〖emperor〗比喻权力极大的人物,有轻蔑意","哼!天王老子我也不怕!","又作\u201c天王老子地王爷\u201d","天王星","Tiānwángxīng","〖Uranus〗按照与太阳的距离排列是第七颗行星,已知有五颗卫星,它的赤道直径约为地球的4倍","天网恢恢","tiānwǎng-huīhuī","〖thenetofHeavenhaslargemeshes,butitletsnothingthrough;millsofGodgrindslowlybutsurely;justicehaslongarm〗天的禁网虽然广大而宽疏,但为恶者却极少能漏脱","天网恢恢,疏而不失。\u2014\u2014《老子》","天威","tiānwēi","〖theprestigeofHeaven;emperor\u2019sprestige〗∶天道威严;也指帝王的威严","〖martialprowers〗∶神奇的威力;神威","天文","tiānwén","〖astronomy〗","天体在宇宙间的分布、运行等现象","天文阴阳历算。\u2014\u2014《后汉书·张衡传》","天文学","天文地理","tiānwén-dìlǐ","〖knowledge〗用\u201c天文地理\u201d来泛指知识、学问,这种说法由来已久,例如许多旧小说中说到一个人很有学问,就说他\u201c上知天文,下知地理\u201d","你莫看他样子蠢,还蛮有灵气,晓得的天文地理还蛮多哩","天文数字","tiānwénshùzì","〖astronomicalfigure;enormousfigure〗因为天文学上所用的数字都很大,所以常用天文数字来表示极大的数字,同时还有夸大、难以实现的含义在内","天文台","tiānwéntái","〖observatorystation〗观测天文和研究天文学的科学机构","天文望远镜","tiānwénwàngyuǎnjìng","〖astronomicaltelescope〗为观测天体设计的望远镜,不需要倒像转正系统","天无二日","tiānwú\u2019èrrì","〖therecannotbetwokingsinacountry〗天空不能有两个太阳同时存在。比喻国家绝无由两个君王共同掌管的道理","天无绝人之路","tiānwújuérénzhīlù","〖Heavennevercutsoffaman'smeans;thereisalwaysawayout〗谓人的处境濒临绝望时,上天总会给以出路","天物","tiānwù","〖allkindsofthingsinnature〗指鸟兽草木等自然界生长的东西","暴殄天物","天下","tiānxià","〖land;wholeChinaunderheaven〗∶四海之内,全中国","鱼鳖鼋鼍为天下富。\u2014\u2014《孙子·谋政》","威天下不以兵革之利。\u2014\u2014《孟子·公孙丑下》","天下三分。\u2014\u2014诸葛亮《出师表》","天下之美。\u2014\u2014明·刘基《郁离子·千里马篇》","〖amongpeople;onsociety〗∶人世间,社会上","天下谁人不识君。\u2014\u2014唐·高适《别董大》","天下物皆然。\u2014\u2014清·袁枚《黄生借书说》","天下事有难易乎。\u2014\u2014清·彭端淑《为学一首示子侄》","〖allovertheworld;wholepeople〗∶全世界,所有的人","天下缟素。\u2014\u2014《战国策·魏策》","天下顺之。\u2014\u2014《孟子·公孙丑下》","以天下之所顺。","先天下之忧而忧。\u2014\u2014宋·范仲淹《岳阳楼记》","后天下之乐而乐。","〖rule;domination〗∶国家或国家的统治权","传天下不足多。\u2014\u2014《韩非子·五蠹》","为天下理财。\u2014\u2014宋·王安石《答司马谏议书》","共争天下。\u2014\u2014《资治通鉴》","天下事谁可支柱者。\u2014\u2014清·方苞《左忠毅公逸事》","〖nature;betweenheavenandearth〗∶自然界,天地间","知天下之寒。\u2014\u2014《吕氏春秋·察今》","天下大乱","tiānxià-dàluàn","〖greatdisorderunderheaven;bigupheavalthroughttheworld〗全国或全世界时局陷入巨大的混乱状态","天下鼎沸","tiānxià-dǐngfèi","〖allbelowheavenareseethinginsurection〗比喻社会动荡,政局不稳,人心焕散,惶惶思变","天下归心","tiānxià-guīxīn","〖throughouttheempireallheartsturnedtohim〗指全国的民心都归于一统,拥戴新的领导者","天下太平","tiānxià-tàipíng","〖allisatpeace〗全国或全世界局势安定","天下乌鸦一般黑","tiānxiàwūyāyībānhēi","〖Onecrowisnotanymorewhiterthananother;Crowsunderthesunareallblack〗无论走到哪里,鸟鸦的羽毛都是黑色的。因以比喻世间的丑类都有着共同之处","天下无双","tiānxià-wúshuāng","〖nonesuchunderheaven;unparalleledintheworld〗天底下绝对凑不成一双。形容世所罕见","天下一家","tiānxià-yījiā","〖allunderheavenareonefamily〗天底下的人亲如一家。形容和平和友谊是世人的共同愿望,国人应以团结为重","天仙","tiānxiān","〖goddess〗∶天上的神仙","〖fairy〗∶仙女","〖beauty〗∶美女","天险","tiānxiǎn","〖naturalbarrier〗天然地势险峻的所在","天线","tiānxiàn","〖antenna;aerials〗作无线电波的发射或接收用的一种金属装置(如杆、线或线的排列)","天香国色","tiānxiāng-guósè","〖heavenfragranceandnationalbeauty;womanofgreatbeauty〗原是形容牡丹花色香俱佳,借指女子容貌出众。也说\u201c国色天香\u201d","天象","tiānxiàng","〖astronomicalphenomena〗∶天文现象。例如月球的盈亏、太阳的出没、行星的冲合、流星的闪逝、彗星的隐现、新星的爆发、日月的交食和极光等","观测天象","〖meteorologicalphenomena;weather〗∶气象;天气","天在下着微微的丝雨。一两天来的悬念和天象预报,毕竟应中了。\u2014\u2014郭沫若《人文界的日蚀》","天象仪","tiānxiàngyí","〖planetariumprojector〗设计成能在特定时刻和地点投影(如在圆顶的天花板上)示出各种天象和天空景色(如夜空景色)的一种光学仪器","天晓得","tiānxiǎode","〖Godknows!〗感叹用语,或者表示对于某些事情难以理解,或者表示有很大的委屈而分辩不清","天心","tiānxīn","〖theskyoverhead〗∶天空的中央","太阳升到了天心","〖God\u2019swill;thewillofHeaven〗∶天意","上合天心","〖monarch\u2019swill〗∶封建时代指君主的意愿","〖balancestaff〗∶摆轴","天性","tiānxìng","〖innatequality;nature〗∶指人先天具有的品质或性情","〖fate;God'swill〗∶天命","天幸","tiānxìng","〖providentialescape;closeshave〗险遭灾祸而幸免的好运气","天旋地转","tiānxuán-dìzhuàn","〖feelfaintanddizzyasiftheskyandearthwerespinninground〗天在旋,地在转。形容大脑旋晕时的感觉。比喻世局大变或乱后而复治","天悬地隔","tiānxuán-dìgé","〖polesapart〗见\u201c天差地远\u201d","天涯","tiānyá","〖endoftheworld;theremotestcorneroftheearth〗在天的边缘处。喻距离很远","天涯若比邻。\u2014\u2014唐·王勃《杜少府之任蜀州》","同是天涯沦落人。\u2014\u2014唐·白居易《琵琶行(并序)》","夕阳西下,断肠人在天涯。\u2014\u2014元·马致远《天净沙·秋思》","天涯海角","tiānyá-hǎijiǎo","〖theuttermostpartsoftheearth;thefarthermostpointsoftheearth〗天的边界,海的角落,指极远的地方。亦形容彼此相隔极远","天涯若比邻","tiānyáruòbǐlín","〖distancecan'tkeepyoutwoapart〗原为唐诗一句。王勃《送杜少府之任蜀州》:\u201c海内存知己,天涯若比邻。\u201d现在常用来表达对远方友人的情谊,特指对外国人的情谊","天呀","tiānya","〖MyGod!〗\u2014\u2014用作感叹语表示惊讶,有时重复使用","我的天呀","天呀!天呀","天演","tiānyǎn","〖Changeofnature〗自然界的变化,即进化","定名天演。\u2014\u2014〖英〗赫胥黎著、严复译《天演论》","以天演为体。","天爷","tiānyé","〖Heavens〗老天爷","天衣无缝","tiānyī-wúfèng","〖becompletelynaturalwithoutdefectsasthedivinegarments〗计划周密,不露形迹,无隙可寻;亦用以称诗文之自然浑成,无斧凿痕迹","天意","tiānyì","〖willofHeaven;God'swill〗∶上天的意旨","〖emperor'sintention〗∶帝王的心意","天有不测风云","tiānyǒubùcèfēngyún","〖sth.mayhappenanytime,asastormmayarisefromaclearsky〗天空中有难以预测的天象,比喻有些事情难以预料","天哟","tiānyo","〖myeye〗\u2014\u2014用于温和的反对或有时表示惊奇","你能做得和他一样好,天哟","天渊","tiānyuān","〖highheavenanddeepsea;bepolesapart〗高天和深渊相隔极远,差别极大","天渊之别","天渊之别","tiānyuānzhībié","〖asfarasheavenfromtheabyssoftheocean;asfarapartasthelandandsky〗比喻高、下相差甚远,区别甚大","天缘","tiānyuán","〖luckychance〗天意安排的机缘;非常巧合的缘份","天缘相遇","天缘奇遇","tiānyuán-qíyù","〖coincident〗天赐机缘,使男女奇巧遇合婚配;天然巧合的缘分","天运","tiānyùn","〖God\u2019swill;fate〗∶天命;自然的气数","决非天运。\u2014\u2014〖英〗赫胥黎著、严复译《天演论》","天运变矣。","〖movementofcelestialbody〗∶天体的运行","天灾","tiānzāi","〖naturaldisaster〗天降的灾祸;自然灾害,如水灾、旱灾、风灾、地震等","天灾可以死。\u2014\u2014清·林觉民《与妻书》","天灾人祸","tiānzāi-rénhuò","〖calamitiesofnatureandcalamitiesimposedbyotherpeople〗泛指旱、涝、地震等天然之灾及战乱、失火、伤亡等人为之祸","天葬","tiānzàng","〖celestialburialbywhichbodiesallexposedtobirdsofprey〗某些民族和宗教处理死尸的方法,把尸体放到旷野或固定葬场让鹰、乌鸦等鸟吃掉","天造地设","tiānzào-dìshè","〖ideal;heavenly〗谓事物自然形成而合乎理想","天真","tiānzhēn","〖nature;freedom〗∶指不受礼俗拘束的品性","〖innocent;naive;artless〗∶引申为单纯、朴实、幼稚;头脑简单","不要太天真,以致相信这些政客的每件事","天真的女孩","天真似五岁的小孩","天真烂慢","tiānzhēn-lànmàn","〖beratherquiyoticassimpleasachild;beinnocentandartless〗性情纯洁无瑕,真率而可爱","园中那些女孩子正是混沌世界,天真烂漫之时。\u2014\u2014《红楼梦》","天之骄子","tiānzhījiāozǐ","〖unsuallyluckyperson;childoffortune〗∶上天的宠儿。汉时,匈奴人自称为\u201c天之骄子\u201d,意为匈奴为天所骄宠,故极强盛。后泛指边疆地区强盛的少数民族或其首领","〖amanofgreatabilityandinfluence〗∶比喻有才能、有影响的人","天知道","tiānzhīdào","〖Godknows!Heavenknows!〗∶天才知道,也就是说,谁也不知道。感叹用语,近似\u201c天晓得\u201d","〖difficulttounderstandordistinguish;Idon'tknowthisfromthat〗∶表示难以理解或无法分辩","天知道那是怎么一回事","天知地知","tiānzhī-dìzhī","〖everybodyknows〗∶天也知,地也知,无人不知","〖nobodyknows〗∶除非天地知道,否则谁都不知道","天知地知你知我知","tiānzhīdìzhīnǐzhīwǒzhī","〖nobodyknowsexceptyouandI〗天地间只有你我两人才知道这个秘密,不能对别人说","天值地值","tiānzhí-dìzhí","〖beworth〗〖西南方言〗∶通常指某种物品价格便宜,完全值得","这么好的鞋子十五块钱一双,天值地值","天职","tiānzhí","〖boundenduty〗应该承担的责任","天质","tiānzhì","〖naturalgift;talent〗∶天资,天赋","非天质之卑。\u2014\u2014明·宋濂《送东阳马生序》","天诛地灭","tiānzhū-dìmiè","〖standdemmedbyGod;maybeexcutedbyheavenanddestroyedbyearth〗受老天的诛伐、大地的灭绝","我便天诛地灭,你又有什么好处。\u2014\u2014《红楼梦》","天竺","Tiānzhú","〖India〗我国古代称印度","天主","Tiānzhǔ","〖God,theLord〗上帝。即天主教所尊奉的神,在教义中认为是世界的创造者和主宰者","天主教","Tiānzhǔjiào","〖Catholicism〗基督教教派的一种,以罗马教皇为最高统治者。明朝时传入我国。又叫\u201c罗马公教\u201d","天主堂","tiānzhǔtáng","〖catherdral〗天主教教会的教堂","天姿","tiānzī","〖looks;good-looking〗姿容;特指俊美的容貌","天姿国色","tiānzī-guósè","〖verybeautiful〗天生丽质,倾国绝色。形容世间少有的美女","这是\u2026崔相国的小姐,世间有此等之女,岂非天姿国色乎!\u2014\u2014元·王实甫《西厢记》","天资","tiānzī","〖talent;naturalendowment〗天赋;资质","天资聪颖","天资雄厚","tiānzī-xiónghòu","〖fecundity〗具有想象或发明的天生的能力","莎士比亚的天资雄厚","天资卓越","tiānzī-zhuōyuè","〖excellentnaturals〗非常优秀的天资","天资卓越的人","天子","tiānzǐ","〖emperor,thesonofGod〗古以君权为神所授,故称帝王为天子","归来见天子。\u2014\u2014《乐府诗集·木兰诗》","天子坐明堂。","天字第一号","tiānzìdì-yīhào","〖ANo.1;tip-top;best;matchless〗我国古代常用《千字文》中的字来为事物编号,《千字文》第一个字是\u201c天\u201d,就用\u201c天字第一号\u201d表示该物是第一的,最高的","天纵","tiānzòng","〖talented〗指上天所赋予,才智超群(多用做对帝王的谀辞)","天尊","tiānzūn","〖spirit;God〗道教徒对所奉神仙的尊称;佛教徒对佛的尊称","天作之合","tiānzuòzhīhé","〖aheaven-madematch;aunionmadebyheaven〗上天成全的婚姻,用来祝颂婚姻美满"]
     */
    public static void insertWordTOWord(WordBean.ResultBean bean){
        ContentValues values = new ContentValues();
        values.put("id",bean.getId());
        values.put("zi",bean.getZi());
        values.put("py",bean.getPy());
        values.put("wubi",bean.getWubi());
        values.put("pinyin",bean.getPinyin());
        values.put("bushou",bean.getBushou());
        values.put("bihua",bean.getBihua());
        //将集合转换成字符串类型进行插入
        String jijie = listToString(bean.getJijie());
        values.put("jijie",jijie);
        String xiangjie = listToString(bean.getXiangjie());
        values.put("xiangjie",xiangjie);
        db.replace(CommonUtil.TABLE_WORD,null,values);

    }

    //将list转换成字符串
    public static String listToString(List<String> list){
        StringBuilder builder = new StringBuilder();
        if (list != null && !list.isEmpty()) {
            for (int i = 0; i <list.size() ; i++) {
                String s = list.get(i);//拿到每一个数据
                s+="|";
                builder.append(s);
            }
        }
        return builder.toString();
    }

    /**
     * 根据传入的汉字查找对应信息的对象
     */
    public static WordBean.ResultBean queryWordFromWord(String word){
        String sql = "select * from WORD where zi=?";
        Cursor cursor = db.rawQuery(sql, new String[]{word});
        if (cursor.moveToFirst()) {
            String id = cursor.getString(cursor.getColumnIndex("id"));
            String zi = cursor.getString(cursor.getColumnIndex("zi"));
            String py1 = cursor.getString(cursor.getColumnIndex("py"));
            String wubi = cursor.getString(cursor.getColumnIndex("wubi"));
            String pinyin = cursor.getString(cursor.getColumnIndex("pinyin"));
            String bushou = cursor.getString(cursor.getColumnIndex("bushou"));
            String bihua = cursor.getString(cursor.getColumnIndex("bihua"));
            String jijie = cursor.getString(cursor.getColumnIndex("jijie"));
            String xiangjie = cursor.getString(cursor.getColumnIndex("xiangjie"));
            List<String> jijieList = stringToList(jijie);
            List<String> xiangjieList = stringToList(xiangjie);
            WordBean.ResultBean bean = new WordBean.ResultBean(id, zi, py1, wubi, pinyin, bushou, bihua, jijieList, xiangjieList);
            return bean;
        }
        return null;
    }
//    将字符串转换成list集合的方法
    public static List<String>stringToList(String msg){
        List<String> list = new ArrayList<>();
        if (!TextUtils.isEmpty(msg)) {
            String[] arr = msg.split("\\|");
            for (int i = 0; i <arr.length ; i++) {
                String s = arr[i].trim();
                if (!TextUtils.isEmpty(s)) {
                    list.add(s);
                }
            }
        }
        return list;
    }
    /*插入成语到成语表*/
    public static void insertCyToCHENGYU(ChengyuBean.ResultBean bean){
        ContentValues values = new ContentValues();
        values.put("name",bean.getName());
        values.put("pinyin",bean.getPinyin());
        values.put("chuchu",bean.getChuchu());
        values.put("liju",bean.getLiju());
        //将集合转换成字符串类型进行插入
        String jbsy = listToString(bean.getJbsy());
        values.put("jbsy",jbsy);
        String xxsy = listToString(bean.getXxsy());
        values.put("xxsy",xxsy);
        String jyc = listToString(bean.getJyc());
        values.put("jyc",jyc);
        String fyc = listToString(bean.getFyc());
        values.put("fyc",fyc);
        db.replace(CommonUtil.TABLE_CHENGYU,null,values);
    }
    /**
     * name : 一心一意
     * pinyin : yī xīn yī yì
     * jbsy : ["心思、意念专一。"]
     * xxsy : ["【解释】：只有一个心眼儿，没有别的考虑。","【出自】：《三国志·魏志·杜恕传》：\u201c免为庶人，徙章武郡，是岁嘉平元年。\u201d裴松之注引《杜氏新书》：\u201c故推一心，任一意，直而行之耳。\u201d","【示例】：所以彭官保便～的料理防守事宜，庄制军便～料理军需器械。 <br>◎清·张春帆《宦海》第四回","【语法】：联合式；作定语、状语；含褒义"]
     * chuchu : 《三国志·魏志·杜恕传》:“免为庶人，徙章武郡，是岁嘉平元年。”裴松之注引《杜氏新书》:“故推一心，任一意，直而行之耳。”
     * liju :
     * jyc : ["一心一计","一心一路","聚精会神","屏气凝神","推心致腹","全心全意","全神关注","真心实意","全神贯注","一心无二","心无旁骛","专心一志","专心致志"]
     * fyc : ["一心二意","筑室道谋","心不在焉","二三其德","三心二意","见异思迁","三心两意","心猿意马","东张西望"]
     */

    /*根据传入的成语查看详情*/
    public static ChengyuBean.ResultBean queryCyFromCHENGYU(String cy){
        String sql = "select * from CHENGYU where name=?";
        Cursor cursor = db.rawQuery(sql, new String[]{cy});
        if (cursor.moveToFirst()) {
            String name = cursor.getString(cursor.getColumnIndex("name"));
            String pinyin = cursor.getString(cursor.getColumnIndex("pinyin"));
            String jbsy = cursor.getString(cursor.getColumnIndex("jbsy"));
            String xxsy = cursor.getString(cursor.getColumnIndex("xxsy"));
            String chuchu = cursor.getString(cursor.getColumnIndex("chuchu"));
            String liju = cursor.getString(cursor.getColumnIndex("liju"));
            String jyc = cursor.getString(cursor.getColumnIndex("jyc"));
            String fyc = cursor.getString(cursor.getColumnIndex("fyc"));
            List<String> jbsyList = stringToList(jbsy);
            List<String> xxsyList = stringToList(xxsy);
            List<String> jycList = stringToList(jyc);
            List<String> fycList = stringToList(fyc);
            ChengyuBean.ResultBean bean = new ChengyuBean.ResultBean(name, pinyin, chuchu, liju,jbsyList, xxsyList, jycList, fycList);
            return bean;
        }
        return null;
    }

    /**************************收藏功能****************************/

    /**
     * 查找汉字收藏表中的所有汉字
     */
    public static List<String> queryAllInCOLLWORD(){
        String sql = "select * from COLLWORD";
        Cursor cursor = db.rawQuery(sql, null);
        List<String> list = new ArrayList<>();
        while (cursor.moveToNext()) {
            String zi = cursor.getString(cursor.getColumnIndex("zi"));
            list.add(zi);
        }
        return list;
    }
    /**
     * 向收藏汉字的表中插入数据
     */
    public static void insertZiToCOLLWORD(String zi){
        ContentValues values = new ContentValues();
        values.put("zi",zi);
        db.replace(CommonUtil.TABLE_COLLWORD,null,values);
    }

    /**
     * 删除收藏汉字表的数据
     */
    public static void deleteZiFromCOLLWORD(String zi){
       String sql = "delete from COLLWORD where zi =?";
       db.execSQL(sql,new Object[]{zi});
    }

    /*查找此汉字是否已收藏*/
    public static boolean isExistInCOLLWORD(String zi){
        String sql = "select * from COLLWORD where zi = ?";
        Cursor cursor = db.rawQuery(sql, new String[]{zi});
        if (cursor.getCount() > 0) {
            return true;
        }else {
            return false;
        }
    }

    /**
     * 查找成语收藏表中的所有成语
     */
    public static List<String> queryAllInCOLLCHENGYU(){
        String sql = "select * from COLLCHENGYU";
        Cursor cursor = db.rawQuery(sql, null);
        List<String> list = new ArrayList<>();
        while (cursor.moveToNext()) {
            String name = cursor.getString(cursor.getColumnIndex("name"));
            list.add(name);
        }
        return list;
    }


    /**
     * 向收藏成语的表中插入数据
     */
    public static void insertCyToCOLLCHENGYU(String cy){
        ContentValues values = new ContentValues();
        values.put("name",cy);
        db.replace(CommonUtil.TABLE_COLLCHENGYU,null,values);
    }

    /**
     * 删除收藏成语表的数据
     */
    public static void deleteCyFromCOLLCHENGYU(String cy){
        String sql = "delete from COLLCHENGYU where name =?";
        db.execSQL(sql,new Object[]{cy});
    }

    /*查找此成语是否已收藏*/
    public static boolean isExistInCOLLCHENGYU(String cy){
        String sql = "select * from COLLCHENGYU where name = ?";
        Cursor cursor = db.rawQuery(sql, new String[]{cy});
        if (cursor.getCount() > 0) {
            return true;
        }else {
            return false;
        }
    }
}
